package com.vastio.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 代替SpringMvc.xml配置文件
 * @author hjwStart
 * @time 2022-11-23 15:06
 * @version: 1.0
 */
@Configuration
@ComponentScan(value = "com.vastio", useDefaultFilters = false,
        includeFilters = {
                @ComponentScan.Filter(Controller.class),
                @ComponentScan.Filter(RestController.class),
                @ComponentScan.Filter(ControllerAdvice.class)
        })
@EnableWebMvc
public class SpringMvcConfig  implements WebMvcConfigurer {

        // 开启默认的servlet处理静态资源
        @Override
        public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
                configurer.enable();
        }

}
